//
//  AuctionOrderListVC.m
//  MyNewProject
//
//  Created by 王春辉 on 1/20/20.
//  Copyright © 2020 sun. All rights reserved.
//

#import "AuctionOrderListVC.h"
#import "OrderDetailViewController.h"

#import "XXPageTabView.h"
#import "XXPageTabItemLable.h"

@interface AuctionOrderListVC ()<XXPageTabViewDelegate>
@property (nonatomic, strong) XXPageTabView *pageTabView;
@end

@implementation AuctionOrderListVC
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    OrderDetailViewController *test = self.pageTabView.childControllers[self.pageTabView.selectedTabIndex];
    [test getData];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = SKColorWithHex(0xF1F1F1);
    OrderDetailViewController *test1 = [OrderDetailViewController new];
    OrderDetailViewController *test2 = [OrderDetailViewController new];
    test1.type = BuyTypeShop;
    test2.type = BuyTypeAuction;
    test1.status = OrderStatusDefault;
    test2.status = OrderStatusDefault;
    [self addChildViewController:test1];
    [self addChildViewController:test2];
    //支持网易云音乐，今日头条，微博等切换栏效果
    self.pageTabView = [[XXPageTabView alloc] initWithChildControllers:self.childViewControllers childTitles:@[@"商城",@"拍卖"]];
    self.pageTabView.delegate = self;
   
    self.pageTabView.tabSize = CGSizeMake(0, 47);
    if (self.isShowTabBar) {
        test1.headerTabHeight = 47;
        test2.headerTabHeight = 47;
    }else {
        test1.headerTabHeight = 0;
        test2.headerTabHeight = 0;
    }
    self.pageTabView.titleStyle = XXPageTabTitleStyleDefault;
    self.pageTabView.indicatorStyle = XXPageTabIndicatorStyleDefault;
   
    self.pageTabView.maxNumberOfPageItems = 5;
    
    self.pageTabView.tabItemFont = SKFONT_Semibold(15.0);
    
    self.pageTabView.indicatorHeight = 3;
    self.pageTabView.indicatorWidth = 44;
    self.pageTabView.unSelectedColor = SKColorWithHex(0x9999999);
    self.pageTabView.selectedColor = SKColorWithHex(0x444444);

    self.pageTabView.indicatorView.backgroundColor = SKColorWithHex(0x000000);
    [self.view addSubview:self.pageTabView];
    
    self.view.backgroundColor = [UIColor lightGrayColor];
    self.pageTabView.selectedTabIndex = 0;
    [self.pageTabView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_offset(0);
        make.top.mas_offset(SKTopBar_Height);
        if (self.isShowTabBar) {
            make.bottom.mas_offset(-SKBottomSafe_Height);
        }else {
            make.bottom.mas_offset(0);
        }
    }];
    [test1 getData];
}
#pragma mark -- mark XXPageTabViewDelegate
- (void)pageTabViewDidEndChange {
    OrderDetailViewController *test = self.pageTabView.childControllers[self.pageTabView.selectedTabIndex];
    [test getData];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
